import 'dart:ui';

import 'package:flutter/material.dart';

class PcScrollConfig extends StatelessWidget {
  final Widget child;

  final bool scrollbars;

  const PcScrollConfig({Key? key, required this.child, this.scrollbars = false})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ScrollConfiguration(
      behavior: const KqScrollBehavior().copyWith(
        scrollbars: scrollbars,
      ),
      child: child,
    );
  }
}

class KqScrollBehavior extends ScrollBehavior {
  final ScrollPhysics? _physics;

  const KqScrollBehavior([this._physics]);

  @override
  ScrollPhysics getScrollPhysics(BuildContext context) {
    return _physics ?? super.getScrollPhysics(context);
  }

  @override
  Widget buildOverscrollIndicator(
      BuildContext context, Widget child, ScrollableDetails details) {
    return child;
  }

  @override
  Set<PointerDeviceKind> get dragDevices => <PointerDeviceKind>{
    PointerDeviceKind.touch,
    PointerDeviceKind.stylus,
    PointerDeviceKind.invertedStylus,
    PointerDeviceKind.mouse,
    PointerDeviceKind.trackpad,
    PointerDeviceKind.unknown,
  };
}
